﻿using System;
using System.Collections.Generic;
using System.Linq;
using ExpenseSystem.Common;
using ExpenseSystem.Fether;
using ExpenseSystem.Model;
using ExpenseSystem.Lor;

namespace ExpenseSystem.Fether
{
    public class CodeGeneratorFetcher : NormalFetcher<CodeGeneratorModel>
    {
        public CodeGeneratorModel GetByCode(long site,string code,out string message)
        {
            IList<CodeGeneratorModel> result = List(site, OrderBy.GetDefault(), Limit.GetDefault(), out message, out rows, Restrain.Eq("Code", code).And(Restrain.Eq("Avaliable", true)));
            CodeGeneratorModel codeGeneratorModel = null;
            if (result.Count > 0)
                return codeGeneratorModel = result.First();
            return null;
        }
    }
}
